<template>
  <div class="modify-dialog">
    <slot></slot>
    <el-dialog v-bind="dialogOpts" :visible.sync="dialogVisible">
      <Form v-bind="formOpts" v-on="formEvent">
        <template #formSuf>
<!--          					<el-form-item label="产品" style="width: 100%">-->
<!--          						<ProductInput-->
<!--          							api="newOrderOutMaterials"-->
<!--          							:params="{ id: row.id }"-->
<!--          							v-model="arr"-->
<!--          						/>-->
<!--          					</el-form-item>-->
          <el-form-item label="发车照片" style="width: 100%">
            <Uploader v-model="fileList" />
          </el-form-item>
        </template>
        <template #formBtn>
          <div class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="onConfirm"> 确 定</el-button>
          </div>
        </template>
      </Form>
    </el-dialog>
  </div>
</template>

<script>
import ProductInput from "./ProductInput.vue";
import modifyMixins from "@/mixins/modifyMixins.vue";

export default {
  mixins: [modifyMixins],
  components: {
    ProductInput,
  },
  data() {
    return {
      dialogTitle: "出库",
      labelPosition: "left",
      dialogWidth: "70vw",
      form: {
        sorter: {
          tag: "el-input",
          label: "拣货人员",
          value: "",
          props: {
            min: 0,
            style: {
              width: "200px",
            },
            placeholder: "请输入拣货人员",
          },
        },
      },
    };
  },
  computed: {},
  methods: {
    onSubmit(form) {
      const { modify, row, fileList } = this;
      // const materials = this.arr
      // 	.filter((e) => e.id && e.count)
      // 	.map((e) => {
      // 		return { id: e.id, count: e.count, norms: e.norms };
      // 	});
      // if (!materials.length) return this.$message.error("请完善产品输入");
      if (!form.sorter) return this.$message.error("请输入拣货人员");
      if (!fileList[0]) return this.$message.error("请上传图片");
      form.id = row.id;
      form.orderId = row.id;
      form.deliveryImg = fileList[0];
      form.status = 0;
      // form.outMaterialsList = materials;
      this.$api.orderOutNew(form).then(this.submitDoneMsg);
      // this.$api.inoutUpdate(form).then(this.submitDoneMsg);
    },
  },
};
</script>

<style lang="less" scoped></style>

